const express = require('express');
const { routeWrapper } = require('../../../lib/module/tool/route');
const router = express.Router();

const creditService = require('../../../lib/service/creditService');

// 信用金还款
router.post('/payment', routeWrapper(async (req) => {
    return creditService.creditRepayment(req.auth.userId, req.body.price, req.body.orderId);
}, true));

// 支付回调（还款回调）
router.post('/:orderId/notify', routeWrapper(async (req) => {
    return creditService.creditPaymentNotify(req.params.orderId);
}, true));

module.exports = router;
